<?php 
	$this->load->view('header');
	$this->load->view('header_end');
	$this->load->view('part_view/mod_banner_header'); 
?>
<div id="block_menu_banner">
	<?php 
		$this->load->view('part_view/mod_menu_top'); 
	?>
</div>
<div id="content_block">
	<div id="left_column">
		<?php 
			$this->load->view('part_view/mod_check_search'); 
		?>
	</div>
	<div id="main_column">
		<div id="main_content">
			<form id="frmHoaDon" name="frmHoaDon" method="post" action="<?php echo base_url().'order_complete/caculator' ?>">
			<?php
				$obj_data = get_page_news(26);
				foreach($obj_data as $data):
					echo $data['cnote'];	
				endforeach; 
			?>
				
			<div id="title" style="text-align:center;font-weight:bold;margin:20px 0;">ĐƠN ĐẶT HÀNG ONLINE</div>
			<p><b>Thông tin khách hàng: </b>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<img src="<?php echo base_url().'images/b_edit.png' ?>" alt="edit" style="vertical-align:middle"/>
				<a class="detail" href="<?php echo base_url().'check_infomation_user/check_user'?>">Sửa thông tin khách hàng</a>
			</p>
			<table border="0" cellpadding="0" cellspacing="1" class="table_listview">
			  <tr>
				<td style="width:200px;">Khách hàng</td>
				<td><?php echo Fget_userdata('session_customer_full_name');?></td>
			  </tr>
			  <tr>
				<td>Địa chỉ giao hàng</td>
				<td><?php echo Fget_userdata('session_customer_address') ;?></td>
			  </tr>
			  <tr>
				<td>Điện thoại</td>
				<td><?php echo Fget_userdata('session_customer_phone') ;?></td>
			  </tr>
			  <tr>
				<td>Email</td>
				<td><?php echo Fget_userdata('session_customer_email') ;?></td>
			  </tr>
			   <tr>
				<td>Thông tin ghi chú</td>
				<td><?php echo Fget_userdata('session_customer_note') ;?></td>
			  </tr>
			</table>
			<!--list of product-->
			<p style="margin-top:20px;"><b>Thông tin sản phẩm: </b></p>
			<table border="0" cellpadding="0" cellspacing="1" class="table_listview" >
				<thead>
					<tr>
						<th style="width:70px">Mã SP</th>
						<th>Tên sản phẩm</th>
						<th style="width:80px">Số lượng </th>
						<th style="width:110px">Đơn giá </th>
						<th style="width:110px">Thành tiền </th>
					</tr>
				</thead>
				<tbody>
					<?php 
						$count = 0;$total = 0;
						if(isset($_SESSION['cart'])):
						foreach($_SESSION['cart'] as $key=>$value): 
						$data	= get_product_byid($key);
						if($data['fprice_sale'] != 0 && $data['fprice_sale'] != '')
							$total += $_SESSION['cart'][$key] * $data['fprice_sale'];
						else
							$total += $_SESSION['cart'][$key] * $data['fprice'];
					?>
					<tr>
						<td><?php echo $data['ccode']; ?></td>
						<td><?php echo $data['cproducts']; ?></td>
						<td><?php echo $_SESSION['cart'][$key] ; ?></td>
						<td style="text-align:right">
							<?php 
								if($data['fprice_sale'] != 0 && $data['fprice_sale'] != '')
									echo show_price($data['fprice_sale']).show_price_sale($data['fprice']);
								else
									echo show_price($data['fprice']);
							?>
						</td>
						<td style="text-align:right">
							<?php 
								if($data['fprice_sale'] != 0 && $data['fprice_sale'] != '')
									echo number_format($_SESSION['cart'][$key]*$data['fprice_sale']).' VNĐ';
								else
									echo number_format($_SESSION['cart'][$key]*$data['fprice']).' VNĐ';
							?>
						</td>
					</tr>
					<?php
						$count++;
						endforeach; 
						endif;						
					?>
				</tbody>
			</table>
			<div id="thanhtien">
				<p><b>Tổng số tiền phải thanh toán: <?php echo number_format($total).' VNĐ' ?></b></p>
			</div>
			
			<div style="margin:20px 0 10px 0;"> 
			<?php
				$obj_data = get_page_news(27);
				foreach($obj_data as $data):
					echo $data['cnote'];	
				endforeach; 
			?>
			  </div>
			  <label>
				<input type="submit" name="btn_xac_nhan" value="Xác nhận" />
			  </label>
		</form>
		</div>
	</div>
</div>
<?php 
	$this->load->view('part_view/mod_home_slide_bottom'); 
	$this->load->view('part_view/mod_footer_content');  
	$this->load->view('footer');
?>



